<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateCustomerDepartmentKpPartyRecordTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('customer_department_kp_party_record', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('taskId')->default(0)->comment('关联任务ID');
            $table->unsignedInteger('followUpId')->default(0)->comment('关联跟进ID');
            $table->string('wgNumber', 12)->default('')->comment('网规编号');
            $table->unsignedTinyInteger('wgType')->default(0)->comment('网规类型');
            $table->string('name', 12)->default('')->comment('客户姓名');
            $table->string('phone', 15)->default('')->comment('联系方式');
            $table->string('wechatCode', 24)->default('')->comment('微信号');
            $table->unsignedTinyInteger('gender')->default(0)->comment('性别');
            $table->string('position', 20)->default('')->comment('职位');
            $table->unsignedTinyInteger('type')->default(0)->comment('客户类别');
            $table->unsignedTinyInteger('label')->default(0)->comment('客户标签');
            $table->string('prefixAddress', 15)->default('')->comment('省市区');
            $table->unsignedInteger('provinceCode')->default(0)->comment('省');
            $table->unsignedInteger('cityCode')->default(0)->comment('市');
            $table->unsignedInteger('districtCode')->default(0)->comment('区');
            $table->string('company', 32)->default('')->comment('所属公司');
            $table->string('companyType', 32)->default('')->comment('公司类型');
            $table->unsignedTinyInteger('onTheJob')->default(0)->comment('是否在职');
            $table->string('remark', 255)->default('')->comment('备注');
            $table->unsignedTinyInteger('cooperate')->default(0)->comment('是否达成合作');
            $table->unsignedInteger('followUpTime')->default(0)->comment('最新跟进时间');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '大客户部kp客户记录';

            $table->index('taskId', 'idx_taskId');
            $table->index('name', 'idx_name');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('customer_department_kp_party_record');
    }
}
